package cn.yunyichina.provider.pay.wechat.service;

import cn.yunyichina.provider.pay.wechat.entity.WechatRefundResponse;
import cn.yunyichina.provider.pay.wechat.entity.common.WechatTradeRefundResponse;
import cn.yunyichina.utils.commons.DateUtils;

import java.util.Date;

/**
 * Created by Lullaby on 2016/12/26.
 */
public class BaseRefundService extends BasePayService {

    protected WechatRefundResponse buildWechatRefundResponse(WechatTradeRefundResponse refundResponse) {
        WechatRefundResponse wechatRefundResponse = new WechatRefundResponse();

        wechatRefundResponse.setPlatformOrderNo(refundResponse.getOutTradeNo());
        wechatRefundResponse.setPlatformSerialNumber(refundResponse.getOutRefundNo());
        wechatRefundResponse.setPayTransactionId(refundResponse.getRefundId());
        wechatRefundResponse.setRefundAmount(refundResponse.getRefundFee());
        wechatRefundResponse.setRefundTime(DateUtils.dateToString(new Date()));

        return wechatRefundResponse;
    }

}
